
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        textarea{resize:vertical;}
    </style>
    <title>实时社区</title>
</head>
<body>
    {{> nav}}   
    {{> body}}
</body>
<template name="body">
    
    {{renderPage}}
    {{#if logingIn}}登录中{{/if}}
</template>

<template name="topics">
<div class="container-fluid">
    <div class="row-fluid">
        
        <div class="span3">
            <div class="well">个人信息</div>
            <a href="new" class="btn btn-primary">发帖</a>
            <div class="btn btn-warning">消息</div>

            <div class="switch small round">
              <input id="x" name="switch-x" type="radio" checked>
              <label for="x" onclick="">Off</label>
              <input id="x1" name="switch-x" type="radio">
              <label for="x1" onclick="">On</label>
              <span></span>
            </div>
        </div>
        <div class="span9">
            <ul class="nav nav-pills">
              <li class="{{active}}">
                <a href="/">全部</a>
              </li>
              {{#each category}}
              <li class="{{active name}}">
                <a href="/c/{{name}}">{{name}}</a>
              </li>
              {{/each}}
            </ul>
            {{#each topics}}
            <div class="well">
                    <h5><a href="/t/{{_id}}">{{title}}</a></h5>
                    <!-- {{content}}<i class="icon-user"></i> -->
                    
                    <p></p>
                    <!-- <span></span> -->
                    <a class="btn btn-mini" href="/u/{{userId}}">{{user.username}}</a>
                    <a class="btn btn-info btn-mini" href="/c/{{categories}}">{{categories}}</a>
                    <span>发表于{{fromnow created}}</span> 
                    <span class="label label-warning">{{reply_count}}</span>
                    <span class="label label-warning">{{views}}</span>
            </div>
            {{/each}}
            <div class="pager">
                <li class=""><a href="{{prev_page}}">上一页</a></li>
                <!-- disabled -->
                <li><a href="{{next_page}}">下一页</a></li>
            </div>
        </div>
    </div>
</div></template>
<template name="topic">
    <div class="container-fluid">
        <div class="row">
            <div class="offset4 span8">
                {{#with topic}}
                <div class="well">
                    <p>{{title}}</p>
                    <p>{{content}}</p>
                    {{fromnow created}}
                    <div class="label">{{views}}</div>
                    <div class="label">{{reply_cont}}</div>
                </div>
                {{/with}}
                
                {{> replys}}
                <form>
                    <label for="reply">回复</label>
                    <textarea rows="8" class="input-xxlarge reply" name="reply" placeholder="内容"></textarea>
                    <p></p>
                    <input type="submit" class="btn" value="写好了">
                </form>  
            </div>
        </div>
    </div>
</template>
<template name="replys">
    {{#each replys}}
        <div class="well">
            <p>{{reply}}</p>
            <a class="btn btn-mini" href="/u/{{userId}}">{{user}}</a>
            <span>{{fromnow created}}</span>
        </div>
    {{/each}}
</template>
<template name="member">
    <div class="container-fluid">
        {{#with member}}
        <div class="span4">
            <p class="title">个人简介</p>
            <p>{{username}} </p>
            {{#if created}}<span>加入于</span> <p>{{fromnow created}} {{/if}}</p>
        </div>
        <div class="span8">
            <div class="well">
                <p class="title">发表的话题</p>
                {{#each topics}}
                <div class="alert alert-success">
                        <h5><a href="/t/{{_id}}">{{title}}</a></h5>
                        <!-- {{content}}<i class="icon-user"></i> -->
                        
                        <p></p>
                        <!-- <span></span> -->
                        <a class="btn btn-mini" href="/u/{{userId}}">{{../username}}</a>
                        <span>发表于{{fromnow created}}</span> 
                        <span class="label label-warning">{{reply_count}}</span>
                        <span class="label label-warning">{{views}}</span>
                </div>
                {{/each}}
            </div>
            <div class="">
                <p class="title">参与的回复</p>
                {{#each replys}}
                    <div class="alert alert-info">
                        <p>{{reply}}</p>
                        <a class="btn btn-mini" href="/u/{{userId}}">{{user}}</a>
                        <span>回复于: </span> <span>{{fromnow created}}</span>
                        {{#with reply_to Topic_id}}
                            <p>回复给{{title}} </p>
                            {{content}}
                        {{/with}}
                    </div>
                {{/each}}
            </div>
        </div>
        {{/with}}
    </div>
</template>
<template name="new">
    <div class="container">
        <div class="offset3 span9">
            <form>
                <label for="title">标题</label>
                <input name="title" class="input-xxlarge" type="text" placeholder="输入一合适的标题">
                <label for="content">内容</label>
                <textarea rows="8" class="input-xxlarge" name="content" placeholder="内容"></textarea>
                <!-- <label for="tags">标签</label>
                <input name="tags" class="input-xxlarge" type="text" placeholder="输入相关标签"> -->
                <p>请选择一个分类:</p>
                <select class="input-xxlarge" name="categories">
                  {{#each category}}
                  <option value ="{{name}}">{{name}}</option>
                  {{/each}}
                </select>
                <p></p>
                <input type="submit" class="btn" value="写好了">
            </form>     
        </div>
    </div>
</template>

<template name="nav">
    <div class="navbar navbar-inverse">
        <div class="navbar-inner">
            <div class="container">
                <a href="javascript:;" class="brand">Alice</a>
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                      </a>
                <div class="nav-collapse collapse">
                    <ul class="nav">
                        <li><a href="/">首页</a></li>
                        <li><a href="/p">主题</a></li>
                        <li><a href="/new">发帖</a></li>
                    </ul>
                    <ul class="nav pull-right">
                        <li>{{loginButtons}}</li>
                        <li><a href="">设置</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">下拉菜单 <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                              <li><a href="#">行为</a></li>
                              <li><a href="#">其他</a></li>
                              <li><a href="#">点击!</a></li>
                              <li class="divider"></li>
                              <li><a href="#">设置</a></li>
                              <li>
                                
                              </li>
                            </ul>
                      </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</template>